

cd "/Users/eliemurard/Dropbox/WorldBank Refugee project/World Dev revision/replication/" 


* Table 4: Refugee resettlement and political fragmentation

* Table 5: Refugee resettlement and turnout


use municipality_voting,clear 

	
	global option varlabels tex plain fragment bdec(3) se starloc(1) starlevels(10 5 1) nocenter ///
		summstat(r2 \ N) summtitle( "$ R^2 $"\"Observations") summdec(3 0)  blankrows 


*define controls for specification 	
			

egen department_FE= group(department)
		

global mun_control   d2rail d2shr d2border  ///
		elevation prcp_ann temp_ann score_suitability ///
		ln_dens_1920 city28 island		
	
	
global model_1  "Geography controls and Population 2011 ","Yes"  \"Socio-Economic Development","" \ "Department FE",""
global model_2  "Geography controls and Population 2011 ","Yes"  \"Socio-Economic Development","Yes" \ "Department FE",""
global model_3  "Geography controls and Population 2011 ","Yes"  \"Socio-Economic Development","Yes" \ "Department FE","Yes"

	
	global m1      $mun_control     i.dec_pop2011  
	global m2 $m1   secondary1991 tertiary1991 emp_noagri1991 topoccu_cond1991 crafts_1991 
	global m3 $m2  i.department_FE 
	
	
	global T1  sh_refugees1928 
	global T2  sh_refugees1923   

	global treat T1 T2

	label var sh_refugees1928  "Share of refugees in 1928"
	label var sh_refugees1923  "Share of refugees in 1923"
	
	
	
***** Political fragmentation	*****
	
	global dependent politics_frag_full_2012    politics_frag_full2015
	
	
foreach typemodel in $treat  {
		
	outreg, clear(base`typemodel')
	global TREATkeep ${`typemodel'}  
		
foreach outcome of varlist $dependent  {	
	
	local labout : variable label  `outcome'
	
		qui su `outcome'    
		local av: di %4.3f  r(mean)
				
		foreach k in  1 2 3    { 	
				qui  reg `outcome'  ${TREATkeep}  ${m`k'}   , vce(cluster department) 
			
				outreg,  merge(base`typemodel')  nod keep( ${TREATkeep} )   ///
						 pretext(  "\caption{Political Fragmentation }" "\begin{adjustbox}{max width=1.2  \textwidth,center}")  ///
						${option} ctitle("sample", "`labout' " )  addrows("","" \  "${model_`k'}" \ "","" \ "Average outcome", `av' \ "",""  ) 	
			}
			}		
			}

		
	outreg , replace  replay(baseT1) append(baseT2)   $option  

				
***** TURNOUT  *****


	global dependent turnout_2012 turnout_2015
	
	
foreach typemodel in $treat  {
		
	outreg, clear(base`typemodel')
	global TREATkeep ${`typemodel'}  
		
foreach outcome of varlist $dependent  {	
	
	local labout : variable label  `outcome'
	
		qui su `outcome'   
		local av: di %4.3f  r(mean)
				
		foreach k in  1 2 3    { 	
				qui  reg `outcome'  ${TREATkeep}  ${m`k'}  , vce(cluster department) 
			
				outreg,  merge(base`typemodel')  nod keep( ${TREATkeep} )   ///
						 pretext(  "\caption{Political Fragmentation }" "\begin{adjustbox}{max width=1.2  \textwidth,center}")  ///
						${option} ctitle("sample", "`labout' " )  addrows("","" \  "${model_`k'}" \ "","" \ "Average outcome", `av' \ "",""  ) 
			
			}
			}
					
			}
		    
		outreg , replace  replay(baseT1) append(baseT2)   $option  
	    
	
	
